package com.jiliang.auth.dao.mapper;


import com.jiliang.auth.dao.model.AuthRoleMember;
import com.jiliang.auth.domain.AuthRoleMemberBo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 用户角色管理自定义mapper接口
 *
 * @author lpp
 * @version 1.0
 * @Date 2018/8/21 14:09
 */
@Mapper
public interface AuthRoleMemberExMapper {
    /**
     * 自定义 关联查询用户功能表
     *
     * @param roleMemberBo
     * @return
     * @author LPP
     * @date 15:03 2018/8/18
     */
    List<AuthRoleMemberBo> selRoleMemberList(AuthRoleMemberBo roleMemberBo);

    /**
     * 查询用户和角色
     *
     * @param roleMember
     * @return java.util.List<com.nxin.middle.jiliang.auth.domain.AuthRoleMemberBo>
     * @author Li Lei
     * @since 2018/12/15 10:22
     */
    List<AuthRoleMemberBo> selRoleMemberPageList(AuthRoleMember roleMember);

    int insertBatchRoleMembers(AuthRoleMemberBo roleMemberBo);

    @Update("update auth_role_member set is_enabled = #{userStatus} where bo_id = #{boId}")
    int freezeRoleMember(String boId, Short userStatus);

    @Delete("delete from auth_role_member where bo_id = #{id}")
    int deleteRoleMember(String id);

    @Select("select role_code from auth_role_member where bo_id = #{boId}")
    List<String> selRoleListByBoId(String boId);
}
